﻿using System;

namespace Payroll.Biz.Legacy.Models
{
    public class ServiceCharge
    {
        public Guid Id { get; private set; }

        public Guid EmployeeId { get; private set; }

        public DateTime Time { get; private set; }

        public decimal Amount { get; private set; }

        public ServiceCharge(Guid id, Guid employeeId, DateTime time, decimal amount)
        {
            Id = id;
            EmployeeId = employeeId;
            Time = time;
            Amount = amount;
        }

        public override string ToString()
        {
            return $"{{{nameof(Id)}={Id.ToString()}, {nameof(EmployeeId)}={EmployeeId.ToString()}, {nameof(Time)}={Time.ToString()}, {nameof(Amount)}={Amount.ToString()}}}";
        }

        public override bool Equals(object obj)
        {
            return (obj is ServiceCharge charge) &&
                Id.Equals(charge.Id) &&
                EmployeeId.Equals(charge.EmployeeId) &&
                (Time == charge.Time) &&
                (Amount == charge.Amount);
        }

        public override int GetHashCode()
        {
            int hashCode = -427371775;
            hashCode = (hashCode * (-1521134295)) + Id.GetHashCode();
            hashCode = (hashCode * (-1521134295)) + EmployeeId.GetHashCode();
            hashCode = (hashCode * (-1521134295)) + Time.GetHashCode();
            hashCode = (hashCode * (-1521134295)) + Amount.GetHashCode();
            return hashCode;
        }
    }
}